package com.ssmintegration.controller;

import com.google.gson.Gson;
import com.ssmintegration.entity.OneToOne;
import com.ssmintegration.service.OneToOneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping(value = "/onetoone",produces = "text/html;charset=utf8")
public class OneToOneController {

    @Autowired
    private OneToOneService oneToOneService;

    @ResponseBody
    @RequestMapping("/selectAll")
    public String selectAll(){
        List<OneToOne> oneToOnes = oneToOneService.selectAll();
        Gson gson = new Gson();
        return gson.toJson(oneToOnes);
    }

}
